SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.AlumnosPilquenDivisiones
AS
SELECT     SageNET.dbo.tb_Alumnos.Apellidos AS ApellidoEducacion, sagenacional.dbo.Alumnos_Pilquen.[ Apellido ] AS ApellidoPilquen, 
                      SageNET.dbo.tb_Alumnos.Nombres AS NombreEducacion, sagenacional.dbo.Alumnos_Pilquen.[ Nombre ] AS NombrePilquen, SageNET.dbo.tb_Alumnos.Documento, 
                      SageNET.dbo.tb_Divisionestemp.Mnemo, SageNET.dbo.tb_AlumnoDivision.AnioLectivo, SageNET.dbo.tb_Divisionestemp.CUISE
FROM         sagenacional.dbo.Alumnos_Pilquen INNER JOIN
                      SageNET.dbo.tb_Alumnos ON sagenacional.dbo.Alumnos_Pilquen.NroDoc = SageNET.dbo.tb_Alumnos.Documento LEFT OUTER JOIN
                      SageNET.dbo.tb_AlumnoDivision ON SageNET.dbo.tb_Alumnos.idAlumno = SageNET.dbo.tb_AlumnoDivision.Alumno INNER JOIN
                      SageNET.dbo.tb_Divisionestemp ON SageNET.dbo.tb_AlumnoDivision.Division = SageNET.dbo.tb_Divisionestemp.idDivision
GO
